﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;
using GameCore;
using HandlingInput;

namespace GameObject
{
    public class NaviBoard: Window
    {
        private ActionBoard actionBoard;

        public NaviBoard()
        {
            actionBoard = new ActionBoard(new Point(3,3));
        }
        public void setActionButton(List<ActionButton> l_actionBt)
        {
            actionBoard.AddAction(l_actionBt);
        }
        public void setActionBoard(ActionBoard act)
        {
            actionBoard = act ;
        }
        public override void Update(GameTime gameTime, float x, float y, int w, int h)
        {
            this.X = x+ViewFrame.window.X;
            this.Y = y+ViewFrame.window.Y;
            this.Width = w;
            this.Height = h;

            EventHandle.Update();

            _lsprite.Clear();

            _lsprite.Add(new Vector2( 0, 0));

            actionBoard.Update(gameTime, X + 2 * w / 3, Y, w / 3, h);



            base.Update(gameTime, X, Y, w, h);
        }
        public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            base.Draw(gameTime, spriteBatch);
            actionBoard.Draw(gameTime, spriteBatch);
        }
        public override VisibleGameObject Clone()
        {
            VisibleGameObject newObj = new NaviBoard();
            newObj._nsprite = this._nsprite;
            ((NaviBoard)newObj).TextDisplay = this.TextDisplay;
            ((NaviBoard)newObj).Font = this.Font;
            ((NaviBoard)newObj).actionBoard = this.actionBoard;

            newObj._sprite = new Sprite[_nsprite];
            for (int i = 0; i < _nsprite; i++)
            {
                newObj._sprite[i] = _sprite[i].Clone();
            }
            newObj.X = this.X;
            newObj.Y = this.Y;
            newObj.Width = this.Width;
            newObj.Height = this.Height;
            newObj._lsprite = new List<Vector2>();
            return newObj;
        }
    }
}
